<%@include file="/page/tag.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<!--框架必需start-->
<script type="text/javascript" src="${ctp}/QUI/libs/js/jquery.js"></script>
<script type="text/javascript" src="${ctp}/QUI/libs/js/language/cn.js"></script>
<script type="text/javascript" src="${ctp}/QUI/libs/js/framework.js"></script>
<link href="${ctp}/QUI/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
<link href="${ctp}/QUI/libs/skins/lightBlue/style.css" rel="stylesheet" type="text/css" id="theme" themeColor="deepBlue"/>
<!--框架必需end-->

<!--数据表格start-->
<script src="${ctp}/QUI/libs/js/table/quiGrid.js" type="text/javascript"></script>
<!--数据表格end-->

<!--箭头分页start-->
<script type="text/javascript" src="${ctp}/QUI/libs/js/nav/pageArrow.js"></script>
<!--箭头分页end-->

<!--树组件start -->
<script type="text/javascript" src="${ctp}/QUI/libs/js/tree/ztree/ztree.js"></script>
<link href="${ctp}/QUI/libs/js/tree/ztree/ztree.css" rel="stylesheet" type="text/css"/>
<!--树组件end -->

<!-- 日期选择框start -->
<script type="text/javascript" src="${ctp}/QUI/libs/js/form/datePicker/WdatePicker.js"></script>
<!-- 日期选择框end -->

</head>
<body style="background-color:#ffffff;">

<!-- <div class="box2" panelTitle="条件查询" id="searchPanel">
	<table>
		<tr>
			<td>
				状态:
			</td>
			<td>
				<select id="statusS">
					<option value="">全部</option>
					<option value="true">启用</option>
					<option value="false">禁用</option>
				</select>
			</td>
		</tr>
	</table>
</div> -->

<div class="padding_right5">
	<div id="maingrid">
    </div>
</div>	

<div id="pageContent" style="height:35px;"></div> 	


<input id="tableName" type="hidden" value="<c:out value="${param.tableName}"/>"/>
<input id="tableColumn" type="hidden" value="<c:out value="${param.tableColumn}"/>"/>
<script type="text/javascript" src="${ctp}/js/list.js"></script>
<script type="text/javascript" src="${ctp}/js/httpUtil.js"></script> 
<script type="text/javascript" src="${ctp}/js/dateUtil.js"></script> 
<script type="text/javascript">
var g_pageNo = 1;
var g_pageSize = 20;
var childTableArr = [];
var tableName,tableColumn;

//数据表格使用
var g;
var gridData;
function initComplete(){
	tableName = $("#tableName").val();
	tableColumn = $("#tableColumn").val();
	
	var columns = new Array();
	columns.push( { display: 'id', isAllowHide: false, name: 'sysStateId',hide:true });
	if(tableName == ''){
		columns.push( { display: '表名',  name: 'tableName',  isAllowHide: false,   align: 'center',  width:"10%" });
		columns.push( { display: '字段名',  name: 'tableColumn',  isAllowHide: false,   align: 'center',  width:"10%" });
	}
	columns.push( { display: '值',  name: 'tableKey',  isAllowHide: false,   align: 'center',  width:"10%" });
	columns.push( { display: '描述',  name: 'tableValue',  isAllowHide: false,   align: 'center',  width:"30%" });
	columns.push( { display: '操作', isAllowHide: false, align: 'center',  width:"10%", render: function (rowdata, rowindex, value, column){
						  	  return '<div class="padding_top4 padding_left5">'
							  + '<span class="img_view hand" title="查看" onclick="onView(\'' + rowdata.sysStateId+ '\')"></span>' 
							  + '<span class="img_edit hand" title="修改" onclick="onEdit(\'' + rowdata.sysStateId + '\')"></span>' 
							  + '<span class="img_delete hand" title="删除" onclick="onDel(\'' + rowdata.sysStateId + '\')"></span>' 
							  + '</div>';
						  }
						  });
	
	g = $("#maingrid").quiGrid({
		columns: columns, 
		          data:[],
		          sortName: 'sortIndex',
		          sortOrder: 'desc',
		          rownumbers:true,
		          percentWidthMode:true,
		          dataAction:'dataAction',
		          enabledSort:false,
		          checkbox:false,
		          usePager: false,
		          height: '100%',
		          width:"100%",
		          isScroll: false,
		          frozen:false,
		          toolbar:{
		        	  items:[
		        	         {text: '新增', click: addColumn,    iconClass: 'icon_add'},
		        	         {text: '刷新', click: reflushList,    iconClass: 'icon_refresh'}
		        	         ]
		          },
		          onChangeSort : function(){
		        	  getData(g.options.url, g.options.data, g_pageNo, g_pageSize);
		        	  return false;
		          }
	});
}

$(function(){
	if(tableName == ''){
		g.options.data = {	
				"pageNo": g_pageNo,
				"pageSize": g_pageSize,
				"filter_EQB_isDel":false
		};
	} else{
		g.options.data = {	
				"pageNo": g_pageNo,
				"pageSize": g_pageSize,
				"tableName":tableName,
				"tableColumn":tableColumn, 
		};
	}
	childTableArr = new Array();
	g.options.url = "${ctp}/sysState/sysState_list.do";
	
	getData(g.options.url, g.options.data, g_pageNo, g_pageSize);
});

//新增
function addColumn(){
	top.Dialog.open({
		URL:"${ctp}/sysState/sysState_edit.html?tableName=" + tableName + "&tableColumn=" + tableColumn,
		Title:"新增",
		Width:500,
		Height:250
	});
}

//更新
function onEdit(id){
	top.Dialog.open({
		URL:"${ctp}/sysState/sysState_edit.html?id=" + id +"&tableName="+ tableName + "&tableColumn=" + tableColumn,
		Title:"更新",
		Width:500,
		Height:250
	});
}

//查看
function onView(id){
	top.Dialog.open({
		URL:"${ctp}/sysState/sysState_detail_"+id+".html" ,
		Title:"查看",
		Width:500,
		Height:250
	});
}

function onDel(id){
	top.Dialog.confirm("确定删除该记录",function(){
		var url = "${ctp}/sysState/sysState_del_"+id+".do";
		 $.ajax({
			url:url ,
			success:function(data){
			    top.Dialog.alert("删除成功|标题",function(){reflushList();});
			}
		});  
	},function(){top.Dialog.close();});
}


</script> 
</body>
</html>
